package Demo2;

/**
 * Created with  IntelliJ IDEA .
 * Description:
 * User: lenovo
 * Date: 2025-${ MONTH }-20
 * Time: 15:13
 */
public class Computer implements USB{

    public void OpenDevice(){
        System.out.println("打开电脑");
    }

    public void CloseDevice(){
        System.out.println("关闭电脑");
    }

    public void UseUsbDevice(USB usb){
        usb.OpenDevice();
        if(usb instanceof Mouse){
            Mouse mouse = (Mouse) usb;
            mouse.Click();
        }else{
            KeyBoard keyBoard = (KeyBoard) usb;
            keyBoard.Imput();
        }
        usb.CloseDevice();
    }

}
